{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/find-lucky-integer-in-an-array\n",
    "\n",
    "\n",
    "Runtime: 104 ms, faster than 5.45% of C++ online submissions for Find Lucky Integer in an Array.\n",
    "\n",
    "Memory Usage: 10.6 MB, less than 50.81% of C++ online submissions for Find Lucky Integer in an Array.\n",
    "\n",
    "\n",
    "```c++\n",
    "class Solution {\n",
    "public:\n",
    "    int findLucky(vector<int>& arr) {\n",
    "        int max_num = 0;\n",
    "        int counting = 0;\n",
    "        int num = -1;\n",
    "        for(std::size_t i = 0; i < arr.size(); ++i) {\n",
    "            counting = count(arr.begin(),arr.end(), arr[i]);\n",
    "            if (counting == arr[i]) {\n",
    "                if (counting > max_num) {\n",
    "                    num = arr[i];\n",
    "                    max_num = counting;\n",
    "                }\n",
    "            }\n",
    "        }\n",
    "        return num;\n",
    "    }\n",
    "};\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "C++17",
   "language": "C++17",
   "name": "xcpp17"
  },
  "language_info": {
   "codemirror_mode": "text/x-c++src",
   "file_extension": ".cpp",
   "mimetype": "text/x-c++src",
   "name": "c++",
   "version": "17"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
